﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Client_Server_Interface
{
    public class ServerRequestException : Exception
    {
        public enum ExceptionSubject
        {
            Error,
            AccessDenied,
        }

        public ExceptionSubject Subject { get; private set; }

        public ServerRequestException(ExceptionSubject subject, string message)
            : base(message)
        {
            Subject = subject;
        }

        public ServerRequestException(ExceptionSubject subject, string message, Exception innerException)
            : base(message, innerException)
        {
            Subject = subject;
        }

        public static void Throw(ExceptionSubject subject, string message)
        {
            throw new ServerRequestException(subject,message);
        }

        public static void Throw(ExceptionSubject subject, string message, Exception innerException)
        {
            throw new ServerRequestException(subject, message, innerException);
        }
    }

    public class IncorrectInputValueException : Exception
    {
        public string IncorrectValue { get; private set; }

        public IncorrectInputValueException(string incorrectValue, string message)
            : base(message)
        {
            IncorrectValue = incorrectValue;
        }

        public static void Throw(string incorrectValue, string message)
        {
            throw new IncorrectInputValueException(incorrectValue, message);
        }
    }

    public class ClientException : Exception
    {

        public string AdditionalInfo { get; set; }

        public ClientException(string message, string additionalInfo = null)
            : base(message)
        {
            AdditionalInfo = additionalInfo;
        }

        public static void Throw(string message, string additionalInfo = null)
        {
            throw new ClientException(message, additionalInfo);
        }
    }

}
